import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { resolve } from "path";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";

// https://vitejs.dev/config/
export default defineConfig({
	publicPath: "./",
	base: "./",
	plugins: [
		vue({ reactivityTransform: true }),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
	resolve: {
		host: "0.0.0.0",
		alias: {
			"@": resolve(__dirname, "src"), // 设置 `@` 指向 `src` 目录
		},
	},
	server: {
		https: false,
		open: true,
		port: "10086",
		hmr: true,
		usePolling: true,
	},
});
